package sk.fhi.server.handler;

import java.util.ArrayList;
import java.util.List;

import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.DispatchException;
import sk.fhi.shared.rpc.action.ListAction;
import sk.fhi.shared.rpc.result.ListResult;

public class ListHandler extends AbstractActionHandler<ListAction, ListResult> {

	@Override
	public Class<ListAction> getActionType() {
		return ListAction.class;
	}

	@Override
	public ListResult execute(ListAction paramA,
			ExecutionContext paramExecutionContext) throws DispatchException {
		List result = crudService.list(paramA.getKind().getClass());
		return new ListResult((ArrayList) result);
	}

}
